//
//  WelcomeViewController.swift
//  WeiBoSwift
//
//  Created by Jacky Sun on 16/5/5.
//  Copyright © 2016年 syf. All rights reserved.
//

import UIKit
import SDWebImage

class WelcomeViewController: UIViewController {

    /// 用户头像
    @IBOutlet weak var iconIMg: UIImageView!
    /// 提示信息
    @IBOutlet weak var messagetLab: UILabel!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        iconIMg.layer.cornerRadius = 50
        setUpSubview()
    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        NSThread.sleepForTimeInterval(0.3)
      UIView.transitionWithView(iconIMg, duration: 1.5, options: UIViewAnimationOptions.TransitionFlipFromLeft, animations: {
        self.messagetLab.alpha = 1.0
        }) { (_) in
            
            // 授权成功后，去tabbar
         NSNotificationCenter.defaultCenter().postNotificationName(SwitchWindowRootViewController, object: true)
        }
       }

    
    /**
     设置子控件
     */
    private func setUpSubview() {
        messagetLab.alpha = 0.0

        if let imgStr =  UserAccount.getUserAccount()?.avatar_large{
            
            let url = NSURL(string: imgStr)
               iconIMg.sd_setImageWithURL(url)
        }
        
    }
}
